 /**
 * @author Richie
 * @constructor 
 */
CheckNetworkUtil = function () {
	/**
	 * <b>XSS修補.特殊字元轉換函式</b>
	 * @param	origStr	原先字串
	 * @param	target	指定目標
	 * @param	replacement 更換字串
	 * @return	{String}
	 */
	this.checkXSS = function (orgStr) {
		var resultStr = "";
		if(orgStr!=null){
			orgStr = replaceAll(orgStr, "&", "&amp;");			//&
			orgStr = replaceAll(orgStr, ">", "&gt;");			//>
			orgStr = replaceAll(orgStr, "<", "&lt;");			//<
			orgStr = replaceAll(orgStr, String.fromCharCode(34), "&quot;");		//"
			orgStr = replaceAll(orgStr, String.fromCharCode(39), "&#39;");		//'
			orgStr = replaceAll(orgStr, String.fromCharCode(32), "&nbsp;");		//空白
			orgStr = replaceAll(orgStr, String.fromCharCode(10), "<br />");		//\n
			orgStr = replaceAll(orgStr, String.fromCharCode(13), "&amp;");		//\r\n
		}
		resultStr = orgStr;
		return origStr;
	};
	
	/**
	 * <b>javascript replaceAll</b>
	 * @param	origStr	原先字串
	 * @param	target	指定目標
	 * @param	replacement 更換字串
	 * @return	{String}
	 */
	var replaceAll = function (origStr, target, replacement){
		var index = 0;
		while (origStr.indexOf(target, index) != -1){
			origStr = origStr.replace(target, replacement);
			index = origStr.indexOf(target, index);
		}
		return origStr;
	};
};

var CheckNetworkUtil = new CheckNetworkUtil();